package cc.mrbird.demo.config;

import org.springframework.context.annotation.Condition;
import org.springframework.context.annotation.ConditionContext;
import org.springframework.core.type.AnnotatedTypeMetadata;

/**
 * # 条件注册组件
 *
 * @author: chenhs
 * @date: Created in 22:18 2020/3/16
 **/
public class MyCondition implements Condition {
    @Override
    public boolean matches(ConditionContext context, AnnotatedTypeMetadata metadata) {
        String osname = context.getEnvironment().getProperty("os.name");
        return osname != null && osname.equals("Windows 10");
       // return osname != null && osname.equals("CentOS 7");
    }
}
